﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace TCL.FUNC
{
    public class ErrorLog
    {
        public static bool WriteToEventLog(string entry, string sSource = "NMT_", EventLogEntryType eventType = EventLogEntryType.Information, string sLog = "Application")
        {
            EventLog objEventLog = new EventLog();
            try
            {
                if (!EventLog.SourceExists(sSource))
                    EventLog.CreateEventSource(sSource, sLog);
                objEventLog.Source = sSource;
                objEventLog.WriteEntry(entry, EventLogEntryType.Information);
                return true;
            }
            catch (System.Exception Ex)
            {
                return false;
            }
        }
    }
}
